<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:include="common :: header">

</head>
<link rel="stylesheet" href="/layui/css/layui.css" media="all" />
<body>

<div id="topbox" th:include="common :: topBar('news')">

</div>

<div class="banner" th:include="common :: banner(${pictures})">

</div>

<div class="nybox">
    <div class="nytop">
        <div class="nytopA"><span>新闻中心</span><em>NEWS</em></div>
    </div>
    <div id="nytopB">
        <a  href="javascript:;" th:each="cate :${categories}" th:class="${activeId}==${cate.categoryId}?'active'"  th:text="${cate.name}" th:id="${cate.categoryId}"></a>
    </div>
    <div class="ny_news">
        news
    </div>

    <div id="pageBar" style="padding-left:600px">

    </div>

</div>


<div class="foot" th:include="common :: footer">


</div>


<div class="floating_ck">
    <dl>

        <dd class="quote">
            <a href="http://wpa.qq.com/msgrd?v=3&amp;uin=555555555&amp;site=qq&amp;menu=yes"
               target="_blank"><span>客服</span></a>
        </dd>

        <dd class="qrcord">
            <span>微信</span>
            <div class="floating_left floating_ewm">
                <i><img src="/images/ewm.png"></i>
                <p class="qrcord_p01">扫一扫，获取更多资讯</p>
                <p class="qrcord_p02">咨询热线<br>0898-6587 5382</p>
            </div>
        </dd>
        <dd class="return">
            <span onclick="gotoTop();return false;">顶部</span>
        </dd>
    </dl>
</div>


</body>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript">
    layui.config({
        base : "js/"
    }).use(['form','layer','jquery','laypage'],function(){
        var form = layui.form,
            layer = layui.layer,
            laypage = layui.laypage,
            $ = layui.jquery;
        $(function(){
            $.get('getContentPage/'+$("a.active").attr("id"),function(resp){
                renderPage(resp.data);
            });
        })

        $("body").on("click","#nytopB>a",function(){
            $("#nytopB>a").removeClass("active");
            $(this).addClass("active");
            $.get('getContentPage/'+$(this).attr("id"),function(resp){
                renderPage(resp.data);
            });
        });


        function renderPage(messages){
            if(messages.length==0) {
                layer.msg("没有更多内容");
                return;
            }
            laypage.render({
                elem : 'pageBar',
                count : messages.length,
                theme: '#FF5722',
                limit : 5,
                jump: function(obj, first){
                    var str = "<ul>";
                    var lim = 0;
                    for(var i=0; i<messages.length; i++){
                        if(i<((obj.curr-1)*obj.limit))
                            continue;
                        var d = new Date(messages[i].updateTime);
                        str += '<li>';
                        str += '<a href="/detail.html/'+messages[i].messageId+'" target="_blank">';
                        str += '<div class="news_img">';
                        str += '<img src="'+messages[i].imgUrl+'">';
                        str += '</div>';
                        str += '<div class="news_sj">';
                        str += '<h3>'+d.getFullYear()+'</h3>';
                        str += '<h2>'+(d.getMonth() + 1) + '-' + d.getDate()+'</h2>';
                        str += '</div>';
                        str += '<div class="news_nr">';
                        str += '<h2>'+ messages[i].name+'</h2>';
                        str += '<h3>'+ messages[i].description +'</h3>';
                        str += '</div>';
                        str += '</a>';
                        str += '</li>';
                        lim++;
                        if(lim >= obj.limit) break;
                    }
                    str += "</ul>";
                    $(".ny_news").html(str);
                }
            });
        }
    });
    $(".banner").slide({
        titCell: ".hd ul",
        mainCell: ".bd ul",
        effect: "fold",
        autoPlay: true,
        autoPage: true,
        trigger: "click"
    });
</script>
</html>